﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace NHook
{
	public class Helper
	{
		public static MethodInfo GetMethodInfo<T>(string method)
		{
			return typeof(T).GetMethod(method, BindingFlags.Public | BindingFlags.Instance);
		}
		public static string GetMethod<T>(string method)
		{
			return GetMethod(Helper.GetMethodInfo<T>(method));
		}
		public static string GetMethod<T>(Delegate delega)
		{
			return GetMethod(delega.Method);
		}

		public static string GetMethod(MethodInfo method)
		{
			return String.Format("{0:X}", method.MethodHandle.GetFunctionPointer().ToInt32());
		}
		public static void PrintMethodAddr<T>(string method)
		{
			Console.WriteLine(GetMethod<T>(method));
		}
	}
}
